package com.sunday.android.fangdaifu.bukong.http;


import com.sunday.android.fangdaifu.bukong.entity.BindBack;
import com.sunday.android.fangdaifu.bukong.entity.House;
import com.sunday.android.fangdaifu.bukong.entity.HouseDetail;
import com.sunday.android.fangdaifu.bukong.entity.IndexHouseDetail;
import com.sunday.android.fangdaifu.bukong.entity.IndexProject;
import com.sunday.android.fangdaifu.bukong.entity.IndexProjectDetail;
import com.sunday.android.fangdaifu.bukong.entity.IndexTop;
import com.sunday.android.fangdaifu.bukong.entity.InstallEquipment;
import com.sunday.android.fangdaifu.bukong.entity.Member;
import com.sunday.android.fangdaifu.bukong.entity.NewsItem;
import com.sunday.android.fangdaifu.bukong.entity.NewsTitle;
import com.sunday.android.fangdaifu.bukong.entity.Option;
import com.sunday.android.fangdaifu.bukong.entity.ProjectListItem;
import com.sunday.android.fangdaifu.bukong.entity.UploadImgBack;
import com.sunday.android.fangdaifu.bukong.entity.WarnItem;
import com.sunday.common.model.ResultDO;
import com.sunday.member.entity.Version;

import java.util.List;

import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;

/**
 * Created by admin on 2016/12/21.
 */

public interface ApiService {

    @FormUrlEncoded
    @POST("/mobi/inspectorate/AaLogin")
    Call<ResultDO<Member>> AaLogin(@Field("type") int type,
                                   @Field("username") String username,
                                   @Field("password") String password);

    @FormUrlEncoded
    @POST("/mobi/inspectorate/AbSendActiveCode")
    Call<ResultDO> AbSendActiveCode(@Field("mobile") String mobile);

    @FormUrlEncoded
    @POST("/mobi/inspectorate/AcValidateActiveCode")
    Call<ResultDO<Member>> AcValidateActiveCode(@Field("mobile") String mobile,
                                                @Field("activeCode") String activeCode);

    @FormUrlEncoded
    @POST("/mobi/inspectorate/AdSetPassword")
    Call<ResultDO> AdSetPassword(@Field("userId") long userId,
                                 @Field("password") String password);

    @FormUrlEncoded
    @POST("/mobi/dispatched/AaIndexCount")
    Call<ResultDO<IndexTop>> AaIndexCount(@Field("userId") long userId);

    @FormUrlEncoded
    @POST("/mobi/dispatched/AbIndexProjectList")
    Call<ResultDO<List<IndexProject>>> AbIndexProjectList(@Field("userId") long userId);

    @FormUrlEncoded
    @POST("/mobi/dispatched/AcProjectDetail")
    Call<ResultDO<IndexProjectDetail>> AcProjectDetail(@Field("id") long id);

    @FormUrlEncoded
    @POST("/mobi/dispatched/AdItemDetail")
    Call<ResultDO<IndexHouseDetail>> AdItemDetail(@Field("id") long id);

    @FormUrlEncoded
    @POST("/mobi/dispatched/AePointList")
    Call<ResultDO<List<InstallEquipment>>> AePointList(@Field("itemId") long itemId,
                                                       @Field("status") int status);

    @FormUrlEncoded
    @POST("/mobi/dispatched/AfChoosePlant")
    Call<ResultDO<List<Option>>> AfChoosePlant(@Field("plantNo") String plantNo,
                                               @Field("type") int type,
                                               @Field("pageNo") int pageNo,
                                               @Field("pageSize") int pageSize);

    @FormUrlEncoded
    @POST("/mobi/dispatched/BaWarningList")
    Call<ResultDO<List<WarnItem>>> BaWarningList(@Field("userId") long userId,
                                                 @Field("plantNo") String plantNo,
                                                 @Field("projectId") Long projectId,
                                                 @Field("type") Integer type,
                                                 @Field("status") Integer status,
                                                 @Field("pageNo") int pageNo,
                                                 @Field("pageSize") int pageSize);

    @FormUrlEncoded
    @POST("/mobi/dispatched/BbProjectList")
    Call<ResultDO<List<ProjectListItem>>> BbProjectList(@Field("userId") long userId,
                                                        @Field("name") String name);

    @POST("/mobi/portal/itemList")
    Call<ResultDO<List<NewsTitle>>> itemList();

    @FormUrlEncoded
    @POST("/mobi/portal/list")
    Call<ResultDO<List<NewsItem>>> list(@Field("itemId") long itemId,
                                        @Field("pageNo") int pageNo,
                                        @Field("pageSize") int pageSize);

    @FormUrlEncoded
    @POST("/mobi/portal/show")
    Call<ResultDO<List<NewsItem>>> show(@Field("itemId") long itemId);

    @Multipart
    @POST("/mobi/portal/AaImage")
    Call<ResultDO<UploadImgBack>> AaImage(@Part("image") RequestBody file);

    @FormUrlEncoded
    @POST("/mobi/inspectorate/AsUploadLogo")
    Call<ResultDO> AsUploadLogo(@Field("userId") long userId,
                                @Field("logo") String logo);

    @FormUrlEncoded
    @POST("/mobi/dispatched/AgBindPlant")
    Call<ResultDO<BindBack>> AgBindPlant(@Field("plantId") long plantId,
                                         @Field("pointId") long pointId);

    @FormUrlEncoded
    @POST("/mobi/dispatched/AhTestPlant")
    Call<ResultDO<String>> AhTestPlant(@Field("plantId") long plantId,
                                       @Field("pointId") long pointId, @Field("position") String position,
                                       @Field("data_startVal") String data_startVal, @Field("ew_data_startVal") String
                                               ew_data_startVal, @Field("ns_data_startVal") String ns_data_startVal);

    @FormUrlEncoded
    @POST("/mobi/dispatched/AiUpdateValue")
    Call<ResultDO> AiUpdateValue(@Field("value") String value,
                                 @Field("pointId") long pointId);


    /**
     * @param status 状态(1-预警0-正常)
     */
    @FormUrlEncoded
    @POST("/mobi/dispatched/warning/plant")
    Call<ResultDO<List<HouseDetail>>> getHouseDetail(@Field("userId") long userId,
                                                     @Field("plantNo") String plantNo,
                                                     @Field("houseId") int houseId,
                                                     @Field("type") Integer type,
                                                     @Field("status") int status);


    /**
     * @param
     */
    @FormUrlEncoded
    @POST("/mobi/dispatched/warning/house")
    Call<ResultDO<List<House>>> getHouseList(@Field("userId") long userId,
                                             @Field("houseName") String houseName,
                                             @Field("pageNo") int pageNo,
                                             @Field("pageSize") int pageSize);

    /**
     * @param type        1，安卓巡检版本，2，安卓布控版，3，苹果巡检版，4，苹果布控版
     * @param versionCode
     * @return
     */
    @FormUrlEncoded
    @POST("/sunday/mobile/apk/getApkInfo")
    Call<ResultDO<Version>> checkVersion(@Field("versionCode") int versionCode, @Field("type") int type);

}
